package com.cm.stock.manager.dto;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

@SuppressWarnings("serial")
@Entity
@Table(name = "operation",uniqueConstraints={@UniqueConstraint(columnNames={"code"})})
public class OperationDTO  implements Serializable{

	@Id
	@Column(name = "ID", nullable = false)
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;
	@Column(length=25, nullable=false)
	private String code	;
	private String typeOperation;
	private double montantOperation;
	private Date dateOperation;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "facture_Id",nullable=false)
	private FactureDTO facture;
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getTypeOperation() {
		return typeOperation;
	}
	public void setTypeOperation(String typeOperation) {
		this.typeOperation = typeOperation;
	}
	public double getMontantOperation() {
		return montantOperation;
	}
	public void setMontantOperation(double montantOperation) {
		this.montantOperation = montantOperation;
	}
	public Date getDateOperation() {
		return dateOperation;
	}
	public void setDateOperation(Date dateOperation) {
		this.dateOperation = dateOperation;
	}
	public FactureDTO getFacture() {
		return facture;
	}
	public void setFacture(FactureDTO facture) {
		this.facture = facture;
	}
	public OperationDTO(String code, String typeOperation,
			double montantOperation, Date dateOperation, FactureDTO facture) {
		super();
		this.code = code;
		this.typeOperation = typeOperation;
		this.montantOperation = montantOperation;
		this.dateOperation = dateOperation;
		this.facture = facture;
	}
	public OperationDTO() {
		super();	
	}
	

}
